<?php
if(!session_id()) { session_start(); }
if(!isset($_SESSION['user_id'])) {
	header('Location: index.php');
}
include_once('functions/main_functions.php');
	page_head();
	include_once('classes/contactadminfunctions.class.php');
	include_once('classes/contact.class.php');
	if(isset($_SESSION['user_type'])) {
		$contact = new Contact();
		$contact->setOwner($_GET['id']);
	}
?>
		<div id="main">
			<?php
			$contact = new Contact();
			$results = $contact->readMessage($_GET['id']);
			if($results != 0) {
				echo '<table>';
				for($i=0; $i < count($results); $i++) {
					echo '<tr><td>' . $results[$i]['username'] . '<br></td>';
					echo '<td>' . $results[$i]['contact_message'] . '</td></tr>';
				}
				echo '</table>';
			}
			?>
			Reply:
			<form>
				<input type='hidden' id='ticket-id' value='<?php echo $_GET['id']; ?>' />
				<textarea id="contact-message" rows="4" cols="50">
				</textarea><br/ >
				<input type='submit' value='reply' onclick='reply_inbox(); return false;' />
			</form>
		</div>
<?php
	page_foot();
?>